package com.ybwh.springboot1.common;

import java.io.Serializable;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import lombok.Data;

/**
 * common return
 * 
 * @author xuxueli 2015-12-4 16:32:31
 * @param <T>
 */
@Data
public class ReturnT<T> implements Serializable {
	public static final long serialVersionUID = 42L;

	public static final int SUCCESS_CODE = 200;
	public static final int FAIL_CODE = 500;

	private int code;
	private String msg;
	private T content;

	public ReturnT() {
	}
	
	public ReturnT(int code) {
		this.code = code;
	}

	public ReturnT(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public ReturnT(int code, String msg, T content) {
		this.code = code;
		this.msg = msg;
		this.content = content;
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
	}

}
